<template>
  <div class="inside-page">
    <div class="setting content">
      <p class="detail-title">账号设置</p>
      <!-- <Email :mail="mail" /> -->
      <Mobile :mobile="mobile" @changeMobile="changeMobile" />
      <Password />
    </div>
  </div>
</template>

<script>
import {useraccountSet} from '@/api/users'
export default {
  asyncData: ({ req }) => ({
  }),
  components: {},
  data () {
    return {
      mail: '',
      mobile: '',
    }
  },
  head () {
    return {
      titleTemplate: (titleChunk) => {
        return `${titleChunk} - 大学生找工作、找实习`;
      }
    }
  },
  created () {
    this.fetchData();
  },
  mounted () {
  },
  watch: {
  },
  computed: {
  },
  methods: {
    changeMobile(mobile) {
      mobile && (this.mobile = mobile);
    },
    async fetchData() {
      await useraccountSet({
      }).then(res => {
        if (res.code === 200) {
          this.mail = res.data.email || '';
          this.mobile = res.data.username || '';
        } else {
          this.$message.error(res.msg)
        }
      }).catch(err => {
        console.log(err)
        this.$message.error(err || '网络错误！')
      })
    }
  },
}
</script>

<style lang="scss" scoped>
.inside-page {
  width: 100%;
  position: relative;
  .setting {
    ::v-deep .msgCode {
      margin-top: 0;
      height: 28px;
      width: 100px;
      margin-right: 30px;
    }
  }
}
</style>
